clear
rng default
load IdSetM_final_1
IdSetM{1}=IdSetM_final_1;
load IdSetM_final_2
IdSetM{2}=IdSetM_final_2;
load IdSetM_final_3
IdSetM{3}=IdSetM_final_3; 
load IdSetM_final_4
IdSetM{4}=IdSetM_final_4;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in one dimension %%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ntypes_m=4;
U_1=cell(ntypes_m,1);
U_2=cell(ntypes_m,1);
U_3=cell(ntypes_m,1);
U_4=cell(ntypes_m,1);
for x=1:ntypes_m
    U_1{x}=[min(IdSetM{x}(:,2)); max(IdSetM{x}(:,2))];
    U_2{x}=[min(IdSetM{x}(:,3)); max(IdSetM{x}(:,3))];
    U_3{x}=[min(IdSetM{x}(:,4)); max(IdSetM{x}(:,4))];
    U_4{x}=[min(IdSetM{x}(:,5)); max(IdSetM{x}(:,5))];
end

save('U_intervals.mat', 'U_1', 'U_2', 'U_3', 'U_4')


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% Projections in two dimensions %%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
load U_CS
for x=1:ntypes_m
    %u2x u3x
    M=unique([IdSetM{x}(:,3) IdSetM{x}(:,4)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,2), U_CS(x,3), 60,'r', 'filled')
    xlabel(sprintf('U_{%d2}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d3}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d2_%d3.jpg',x,x))
    
    %u2x u4x
    M=unique([IdSetM{x}(:,3) IdSetM{x}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,2), U_CS(x,4), 60,'r', 'filled')
    xlabel(sprintf('U_{%d2}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d4}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d2_%d4.jpg',x,x))
    
    %u3x u4x
    M=unique([IdSetM{x}(:,4) IdSetM{x}(:,5)], 'rows', 'stable'); 
    figure
    scatter(M(:,1), M(:,2), 60,'k', 'filled')
    hold on
    scatter(U_CS(x,3), U_CS(x,4), 60,'r', 'filled')
    xlabel(sprintf('U_{%d3}',x),'FontSize', 25) 
    ylabel(sprintf('U_{%d4}',x),'FontSize', 25)
    xlim([-15 15])
    ylim([-15 15])
    box on
    set(gca, 'ytick',[-15 0 15],'xtick',[-15 0 15],'FontSize',20)
    saveas(gcf,sprintf('U_%d3_%d4.jpg',x,x))
   

end
close all





